-
Notifications
You must be signed in to change notification settings - Fork 332
feat(frontend): Store last selected game version and platform for download modal #3284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(frontend): Store last selected game version and platform for download modal #3284
Conversation
Stores selected game version and platform(modloader) in localStorage to retrive them when download modal openned
Signed-off-by: Denis <[email protected]>
30a24fb
to
9fdac5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the download modal by persisting the last user-selected game version and platform using localStorage. Key changes include:
- Replacing ButtonStyled blocks with Accordions for game version and platform selection.
- Introducing helper functions (setSelectedGameVersion and setSelectedPlatform) to update both reactive refs and localStorage.
- Loading persisted selections on the client when the page is loaded.
Comments suppressed due to low confidence (2)
apps/frontend/src/pages/[type]/[id].vue:328
- Confirm that changing this condition from v-else-if to v-if does not inadvertently render the platform Accordion for resourcepack projects, potentially affecting the intended download flow.
v-if="project.project_type !== 'resourcepack'"
apps/frontend/src/pages/[type]/[id].vue:880
- [nitpick] Ensure that using localStorage with the keys 'selected_game_version' and 'selected_platform' is consistent with the application standards, and consider any necessary type handling for stored values.
if (import.meta.client) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I understand why you made this PR, the code quality is not great and some things were removed that shouldn't have been removed. Please check my comments, thanks!
function setSelectedGameVersion(version) { | ||
userSelectedGameVersion.value = version; | ||
if (import.meta.client) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than actually calling localStorage, it might be best to use useLocalStorage
composable provided by vueuse, which handles the import.meta.client
stuff for you automatically.
Also, make sure that it correctly falls back to undefined/not set if the local storage game version isn't actually supported by the project.
</div> | ||
</div> | ||
|
||
<div class="mx-auto flex w-fit flex-col gap-2"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed? "Error: no game versions found"
:label="`Show all versions`" | ||
:disabled="!!versionFilter" | ||
/> | ||
</Accordion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, why was this removed?
Stores last user selected game version and platform (aka modloader) to retrive them before openning download modal.
Resolves #2332
PS: It's my first contribution to modrinth. I'm sorry if i did smth wrong